<?php

use yii\db\Migration;

/**
 * Handles the creation of table `activity`.
 */
class m180315_095650_create_activity_table extends Migration
{
    /**
     * @inheritdoc
     */
    public function up()
    {
        $this->createTable('activity_zan', [
            'id' => $this->primaryKey(),
            'name'=> $this->string(16)->notNull()->comment('活动名'),
            'image'=> $this->string(64)->notNull()->comment('店铺图片'),
            'count_1'=> $this->integer()->notNull()->comment('集赞数1'),
            'count_2'=> $this->integer()->comment('集赞数2'),
            'count_3'=> $this->integer()->comment('集赞数3'),
            'gift_1'=> $this->string(16)->notNull()->comment('奖品1'),
            'gift_2'=> $this->string(16)->comment('奖品2'),
            'gift_3'=> $this->string(16)->comment('奖品3'),
            'address'=> $this->string(32)->notNull()->comment('店铺地址'),
            'belong' => $this->string(64)->notNull()->comment('活动商家id'),

            //生成的model继承BaseModel，即可实现以下四个属性的自动更新
            'created_at' => $this->dateTime()->comment('创建时间'),
            'updated_at' => $this->dateTime()->comment('更新时间'),
            'created_by' => $this->integer()->comment('创建者'),
            'updated_by' => $this->integer()->comment('更新者'),
        ]);
    }

    /**
     * @inheritdoc
     */
    public function down()
    {
        $this->dropTable('activity_zan');
    }
}
